using System;

using Nextem.Pipeline;
using Nextem.String;

namespace Renraku.Compiler {
	public module Main {
		public Main(args : array [string]) : void {
			def (arch, off) = 
				match(args.Length) {
					| 2 => ("x86", 0)
					| 3 => (args[0], 1)
					| _ => throw Exception("Compiler.exe [architecture] <input> <output>")
				}
			def pipe = 
				match(arch.ToLower()) {
					| "x86" =>
						pipeline(string) {
							CILLoader.Load();
							CILGraph.FromCIL();
							//SSA.FromCILGraph()
						}
					| arch => throw Exception("Unknown architecture {0}" <- arch)
				}
			print pipe(args[off])
		}
	}
}
